package com.sky.mapper;

import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {

    /**
     * 添加菜品到套餐菜品关系表中
     * @param setmealDish
     */
    void addSetmealDish(List<SetmealDish> setmealDish);

    /**
     * 根据套餐id查询套餐关系id
     * @param setmealId
     * @return
     */
    List<Long> addDishId(List<Long> setmealId);


    /**
     * 根据id删除套餐关系
     * @param id
     */
    @Delete("delete from setmeal_dish where id = #{id}")
    void deleteSetmealDishId(Long id);


    /**
     * 根据套餐ID查套餐有哪些菜
     * @param id
     * @return
     */
    @Select("select * from setmeal_dish  where setmeal_id = #{id}")
    List<SetmealDish> getSetmealDishId(Long id);

    /**
     * 根据套餐id查找套餐菜品关联表的id
     * @param id
     * @return
     */
    @Select("select id from setmeal_dish  where setmeal_id = #{id}")
    List<Long> findSetmealDish(Long id);


}
